package io.renren.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.LineQcodeDao;
import io.renren.modules.sys.entity.LineQcodeEntity;
import io.renren.modules.sys.service.LineQcodeService;


@Service("lineQcodeService")
public class LineQcodeServiceImpl extends ServiceImpl<LineQcodeDao, LineQcodeEntity> implements LineQcodeService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String qcode = (String) params.get("qcode");
        String statu = (String)params.get("statu");
        IPage<LineQcodeEntity> page = this.page(
                new Query<LineQcodeEntity>().getPage(params),
                new QueryWrapper<LineQcodeEntity>()
                .like(StringUtils.isNotBlank(qcode),"qcode",qcode)
                .eq(StringUtils.isNotBlank(statu), "statu", statu)
                .orderByDesc("createtime")
        );

        return new PageUtils(page);
    }
    @Override
    public List<LineQcodeEntity> getLineCode(String qcode){
        List<LineQcodeEntity> list = baseMapper.getLineCode(qcode);
        return list;
    }
}
